home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994…tember: Reference Library / Dev.CD Sep 94.toast / Periodicals / develop / develop Issue 15 / develop 15 code / QD GX Shell / QuickDraw GX Shell (main).h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-02  |  4.1 KB  |  165 lines  |  [TEXT/KAHL]

  1. /**
  2.  --        File:        GX Scrolling (main).h
  3.  --
  4.  --        Comments:    This header file contains the prototypes, constants, and type definitions
  5.  --                    used by "GX Scrolling (main).c" file.
  6.  --
  7.  --        Version:    1.0     1/93      
  8.  --                            => added general GX support & scrolling
  9.  --
  10.  --
  11.  --        Components:    GX Scrolling (main).c
  12.  --                    GX Scrolling (main).h
  13.  --                    GX Scrolling Controls.c
  14.  --                    GX Scrolling Controls.h
  15.  --                    GX Scrolling (main).π.rsrc
  16.  --
  17.  --
  18.  --        Notes:        1) Print this file in landscape for the best results
  19.  --                    2) If you are using THINK C v5.x, I have added markers to navigate the 
  20.  --                       code.
  21.  --                    3) This code was adapted and simplyified from the "DTS AE Skeleton" sample.
  22.  --
  23.  --        Author:        Pete "Luke" Alexander
  24.  --                    Developer Technical Support
  25.  --                    AppleLink: DEVSUPPORT
  26.  --
  27.  --        
  28.  --        ©1992 - 1993  Apple Computer, Inc. 
  29.  --
  30.  **/
  31.  
  32. #include <Menus.h>
  33. #include <OSEvents.h>
  34. #include <Quickdraw.h>
  35. #include <Windows.h>
  36.  
  37. #include "graphics types.h"
  38. #include "PrintingManager.h"
  39.  
  40. /***** Type Definitions *****/
  41. typedef struct MyWindowRecord    /* Tack storage onto the end of the WindowRecord */
  42. {
  43.     WindowRecord    window;
  44.     PicHandle        picture;    /* PICT to display in window */
  45.     Rect            documentBoundsRect;    
  46.     Point            origin;        /* location of upper left corner of picture in window (local) */
  47.     ControlHandle    hScrollBar;    /* Handle to horizontal scroll bar */
  48.     ControlHandle    vScrollBar;    /* Handle to vertical scroll bar */
  49. } MyWindowRecord, *MyWindowPeek;
  50.  
  51.  
  52. /***** Constants *****/
  53. enum
  54. {
  55.     kDriverType            = 'DRVR',    /* Resource Types */
  56.     kPictureType        = 'PICT',
  57.     
  58.     kScrollBarWidth        = 16,        /* Constants */
  59.     kMinWindowWidth        = 100,
  60.     kMinWindowHeight    = 75,
  61.     kTitleBarHeight        = 19,
  62.     kNewWindowOffset    = 1+kTitleBarHeight,
  63.     kMinimumDocumentSize = 64,
  64.     
  65.     rMenuBar            = 1000,        /* Menu bar */
  66.     
  67.     mApple                = 1000,        /* Menus */
  68.     iAbout                = 1,
  69.     
  70.     mFile                = 1001,
  71.     iNew                = 1,
  72.     iOpen                = 2,
  73.     iClose                = 3,
  74.     iSave                = 5,
  75.     iSaveAs                = 6,
  76.     iPrintOneCopy        = 8,
  77.     iDocumentSetup        = 9,
  78.     iPageSetup            = 10,
  79.     iPrint                = 11,
  80.     iQuit                = 13,
  81.  
  82.     mEdit                = 1002,
  83.     iUndo                = 1,
  84.     iCut                = 3,
  85.     iCopy                = 4,
  86.     iPaste                = 5,
  87.     iClear                = 6,
  88.     iSelectAll            = 8,
  89.     
  90.     rAboutBox            = 1000,        /* Alerts */
  91.     rFatalErrorAlert    = 1001,
  92.     rNonFatalErrorAlert    = 1002,
  93.     
  94.     rErrorStrings        = 1000,        /* Errors */
  95.     kNoQDGXErr            = 1,
  96.     kNoQDGXPrintingErr    = 2,
  97.     kNoAppleEventsErr    = 3,
  98.     kNoMenuBarErr        = 4,
  99.     kOutOfMemoryErr        = 5,
  100.     kCanNotOpenFile        = 6,
  101.     kBadPictFile        = 8,
  102.     kPrintingErr        = 9,
  103.     kAppleEventErr        = 10,
  104.     kAppleEventInitErr    = 11,
  105.     kGotOAPP            = 12,
  106.     kGotODOC            = 13,
  107.     kGotPDOC            = 14,
  108.     kGotQUIT            = 15,
  109.  
  110.     rDocumentWindow        = 1000        /* Windows */
  111. };
  112.  
  113.  
  114. //
  115. // Prototypes
  116. //
  117. void HandleEvent(void);
  118. void HandleMouseDown(EventRecord *theEvent);
  119. void HandleKeyPress(EventRecord *theEvent);
  120. void HandleDiskEvent(EventRecord *theEvent);
  121. void HandleOSEvent(EventRecord *theEvent);
  122.  
  123. void DoGrowWindow(WindowPtr theWindow, Point where);
  124. void DoZoomWindow(WindowPtr theWindow, short thePart);
  125. void ActivateWindow(WindowPtr theWindow, Boolean activate);
  126. void FitWindowOnDevice(Rect *windRect, Rect *deviceRect);
  127. Rect GetDeviceRect(WindowPtr theWindow);
  128.  
  129. void DoMenu(long menuChoice);
  130.  
  131. Boolean CreateDocumentWindow(PicHandle thePicture, Str63 name);
  132. void CloseFrontWindow(void);
  133. void DrawWindow(WindowPtr theWindow);
  134. void AdjustMenus(void);
  135.  
  136. void ToolBoxInit(void);
  137. void MenuBarInit(void);
  138. Boolean ColorQDAvail(void);
  139. void ErrorAlert(short errNumber, Boolean fatal);
  140. void ShutdownProgram(void);
  141.  
  142.  
  143. //
  144. // The following functions were added to support GX, create the text and layout shapes,
  145. // support GX printing, and add scrolling window support.
  146. //
  147. void QuickDrawGXInit (void);
  148. Boolean QuickDrawGXInstalled (void);
  149.  
  150. gxShape CreateThePageOfGXShapes (gxShape thePage);
  151. gxShape CreateTextShape (gxShape thePage);
  152. gxShape CreateLayoutShape (gxShape thePage);
  153.  
  154.  
  155. gxJob PrintInit (void);
  156. void DoPrintOneCopy (WindowPtr window, gxJob documentJob, gxShape thePage);
  157. void DoDocumentSetupCommand (gxJob documentJob);
  158. void DoPrintCommand (WindowPtr window, gxJob documentJob,  gxShape thePage);
  159. void TermintatePrintLand (gxJob documentJob);
  160.  
  161. void TranslateWindowBounds(WindowPtr myWindow, gxRectangle *boundingBoxPtr);
  162. void ResetContentViewPortClip (WindowPtr theWindow);
  163.  
  164.  
  165.